<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@page import="service.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script src="js/ajax.js"></script>
<style>
th{
	height:30px;
}
td{
  height:30px;
}

input{
	width:100%;
	height:25px;
}
a{
	text-decoration: none;
}
li a{
	color:#555555;
	font-size:20px;
	border:1px;
	display:block;
	width:100%;
	height:30px;
	padding-top:10px;
    text-align: center;
}

li a:hover{
    background-color:#E7E7E7;
}
</style>
</head>
<body>
<div class="title" style="width:100%; height:80px; background-color:#7080A6; color:white; text-align:center; padding-top:8px; box-sizing:border-box;">
	<h1 class="thetitle">邮件服务器管理界面</h1>
</div>

<div class="left" style="float:left; background-color:#D2DFF0; width:15%; height:500px;"> 
	<ul style="list-style:none; margin:0px; padding:0px; margin-top:20px;">
		<li><a href="serverManage.jsp" style="background-color:#E7E7E7">服务器管理</a></li>
		<li><a href="userManage.jsp">用户管理</a></li>
		<li><a href="logManage.jsp">日志管理</a></li>
		<li><a href="sendMails.jsp">群发邮件</a></li>
	</ul>
</div>
<div class="right" style="float:left; width:85%; height:500px; background-color:#F7F7F7;">
	<form action="./Login_out">
			<button style="margin-left: 95%; margin-top: 3px; display: inline;"
				type="submit">退出</button>
	</form>
	

	<div id="ip" style="float:left; width:96%; height:32%;border:1px solid; margin-top:5px;margin-left:2%;">
		<h5 style="padding-left: 3%">ip地址</h5>
		<p style="padding-left: 10%">欢迎使用邮件服务器，当前版本：Version 5.0</p>
		<p style="padding-left: 10%">当前主机名：   <span id="hostname"></span> 
		<span style="padding-left:60%">
		<input type="button" value="刷新IP" style="width:60px" onclick="refreshIP()">&nbsp;
		<input type="button" value="运行服务器" style="width:80px">
		</span>
		</p>
	</div>
	<div id="smtp" style="float:left; width:96%; height:32%;border:1px solid; margin-left:2%;">
		<h5 style="padding-left: 3%">smtp协议</h5>
		<p style="padding-left: 10%">smtp协议状态：协议已<span id="smtpstate" style="color:#7080A6;">停止</span></p>
		<span style="padding-left:80%">
		<input type="button" value="启动smtp协议" style="width:90px"  onclick="ProtolControl(1)">&nbsp;
		<input type="button" value="停止smtp协议" style="width:90px"  onclick="ProtolControl(2)">
		</span>
	</div>
	<div id="pop3" style="float:left; width:96%; height:32%;border:1px solid; margin-left:2%;">
		<h5 style="padding-left: 3%">pop3协议</h5>
		<p style="padding-left: 10%">pop3协议状态：协议已<span id="pop3state" style="color:#7080A6;">停止</span></p>
		<span style="padding-left:80%">
		<input type="button" value="启动pop3协议" style="width:90px" onclick="ProtolControl(3)">&nbsp;
		<input type="button" value="停止pop3协议" style="width:90px" onclick="ProtolControl(4)">&nbsp;
		</span>
	</div>
</div>
<div class="copyright" style="clear:both; width:100%; height:50px; background-color:#7080A6; color:white; text-align:center; box-sizing:border-box; padding-top:1px;">
	<h3>版权所有</h3>
</div>

<script type="text/javascript">

function refreshIP(){
	document.getElementById("hostname").innerHTML=location.hostname;
}

window.onload = function(){
	var smtpstate = <%=SmtpServer.getOk()%>;
	var pop3state = <%=POP3Server.getOk()%>;
	if(smtpstate==true){
		document.getElementById("smtpstate").innerHTML="启动";
	}else{
		document.getElementById("smtpstate").innerHTML="停止";
	}
	
	if(pop3state==true){
		document.getElementById("pop3state").innerHTML="启动";
	}else{
		document.getElementById("pop3state").innerHTML="停止";
	}
	
	document.getElementById("hostname").innerHTML=location.hostname;
}
</script>
</body>
</html>